package my.algorithm.sort;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用户设备状态
 * @author xsw
 * @date 2018-3-19
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDeviceStateDO {
	private Long id;//自增id
	private Long deviceId;//用户设备id
	private String property;//属性名
	private String name;//值名
	private String value;//具体值
	private Boolean proactivelyReported = false;//是否主动推送状态
	
	/**
	 * 手动重写hashCode（@Data注解已有）
	 */
	@Override
	public int hashCode() {
		int result = 13;
		result = 31 * result + (deviceId == null ? 0 : deviceId.hashCode());
		result = 31 * result + (property == null ? 0 : property.hashCode());
		result = 31 * result + (name == null ? 0 : name.hashCode());
		result = 31 * result + (value == null ? 0 : value.hashCode());
		result = 31 * result + (proactivelyReported == null ? 0 : proactivelyReported.hashCode());
		return result;
	}
	
	/**
	 * 手动重写equals（@Data注解已有）
	 */
	@Override
	public boolean equals(Object obj) {
		if(this == obj)
			return true;
		
		if(!(obj instanceof UserDeviceStateDO)){
			return false;
		}
		
		UserDeviceStateDO uds = (UserDeviceStateDO) obj;
		return (deviceId == null ? uds.deviceId == null : deviceId.equals(uds.deviceId))&&
				(property == null ? uds.property == null : property.equals(uds.property))&&
				(name == null ? uds.name == null : name.equals(uds.name))&&
				(value == null ? uds.value == null : value.equals(uds.value))&&
				(proactivelyReported == null ? uds.proactivelyReported == null : proactivelyReported.equals(uds.proactivelyReported));
	}

}
